import request from '@/utils/request'

// 获取SPU列表
export const reqGetSpuList = ({ page, limit, category3Id }) => {
  return request({
    method: 'GET',
    url: `/admin/product/${page}/${limit}`,
    params: {
      // query参数
      category3Id
    }
  })
}

// 获取基础销售属性列表
export const reqGetBaseSaleAttrList = () => {
  return request({
    method: 'GET',
    url: `/admin/product/baseSaleAttrList`
  })
}

// 添加销售属性
export const reqSaveSaleAttr = data => {
  return request({
    method: 'POST',
    url: `/admin/product/saveSpuInfo`,
    data
  })
}

// 更新销售属性
export const reqUpdateSaleAttr = data => {
  return request({
    method: 'POST',
    url: `/admin/product/updateSpuInfo`,
    data
  })
}

// 根据id获取spu数据
// export const reqGetSpuById = spuId => {
//   return request({
//     method: "GET",
//     url: `/admin/product/getSpuById/${spuId}`
//   });
// };

// 根据id获取spu图片列表数据
export const reqGetSpuImageList = spuId => {
  return request({
    method: 'GET',
    url: `/admin/product/spuImageList/${spuId}`
  })
}

// 根据id获取spu销售属性列表数据
export const reqGetSpuSaleAttrList = spuId => {
  return request({
    method: 'GET',
    url: `/admin/product/spuSaleAttrList/${spuId}`
  })
}
